package com.tiger.easyrpc.rpc;

import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Arrays;

import static com.tiger.easyrpc.common.EasyrpcConstant.DATA_TYPE_INVOKE;

/**
 * 远程调用参数
 */
public  class Parameter implements Serializable {
    //调用类型
    private Integer type = DATA_TYPE_INVOKE;
    //消息唯一id，请求和响应一一对应
    private Long mesId;
    //调用方法参数
    private Object[] objs;
    //远程方法信息
    private Method method;
    //服务名:版本号:分组
    private String serviceName;

    public Parameter(){}


    public Parameter(Long mesId, Object[] objs, Method method,String serviceName) {
        this.mesId = mesId;
        this.objs = objs;
        this.serviceName = serviceName;
        this.method = method;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Long getMesId() {
        return mesId;
    }

    public void setMesId(Long mesId) {
        this.mesId = mesId;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public Object[] getObjs() {
        return objs;
    }

    public void setObjs(Object[] objs) {
        this.objs = objs;
    }


    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    @Override
    public String toString() {
        return "Parameter{" +
                "type=" + type +
                ", mesId=" + mesId +
                ", objs=" + Arrays.toString(objs) +
                ", method=" + method +
                ", serviceName='" + serviceName + '\'' +
                '}';
    }
}
